package cn.tedu.boot311.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AxiosController {
    @RequestMapping("/helloAxios")
    public String helloAxios(){
        return "服务器接受到了请求!";
    }
    @RequestMapping("/test01")
    public String test01(String info){
        return "接受到了:"+info;
    }
    @RequestMapping("/bmi")
    public String bmi(float h,float w){
        //计算bmi的值
        float bmi = w/(h*h);
        String info = null;
        if (bmi<18.5){
            info = "兄弟你瘦了!";
        }else if(bmi<24){
            info = "体重正常!";
        }else if(bmi<30){
            info = "微胖!";
        }else{
            info = "肥胖!";
        }
        return info;
    }
    @RequestMapping("/check")
    public String check(String username){
        if (username.equals("tom")){
            return "用户已存在!";
        }else{
            return "用户名可以使用!";
        }
    }
}
